// Problem: J - Remoteland
// Idea: Sieve, Factoring Factorial, Fast Exponentiation.
// Language: C++
// Author: Ivan Vladimirov Ivanov (ivan.vladimirov.ivanov@gmail.com)

#include <cstdio>
#include <vector>

using namespace std;

typedef long long LL;

#define MAX_N 10001005
#define MOD 1000000007

void init(void);

int  input(void);
void solve(void);

LL power(LL a, LL k);
int cnt_fact(int n, int p);

LL N;
char S[MAX_N];
vector <int> P;

int main(void)
{
  init();

  while(input()) solve();

  return 0;
}

void init(void)
{
  for(int i = 2; i < MAX_N; i++) S[i] = 1;
  for(int i = 2; i * i < MAX_N; i++) {
    if(S[i]) for(int j = i + i; j < MAX_N; j += i) S[j] = 0;
  }
  P.clear();
  for(int i = 2; i < MAX_N; i++) if(S[i]) P.push_back(i);
}

int input(void)
{
  scanf("%lld", &N);
  return N > 0;
}

void solve(void)
{
  LL res = 1;
  for(int i = 0; P[i] <= N; i++) {
    int cnt = cnt_fact(N, P[i]);
    if(cnt % 2) cnt--;
    res = (res * power(P[i], cnt)) % MOD;
  }
  printf("%d\n", (int) res);
}

LL power(LL a, LL k)
{
  LL res = 1;
  LL tmp = a;
  while(k > 0) {
    if(k % 2) res = (res * tmp) % MOD;
    tmp = (tmp * tmp) % MOD;
    k /= 2;
  }
  return res;
}

int cnt_fact(int n, int p)
{
  int res = 0;
  int pp = p;
  while(n / pp > 0) {
    res += n / pp;
    if(pp > 1000000000 / p) break;
    pp *= p;
  }
  return res;
}

